/* $Id:culture.h $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/

#ifndef __CULTURE_H
#define __CULTURE_H

#include <string>
#include <map>
#include <list>
using namespace std;

#include "guild.h"

#define loopCultureGuilds(r,v) loopMap((r)->listGuilds(),v,class guild)

class culture {
    string name;
    string description;
    map<string,class guild> guilds;
public:
    culture();

    // Field : name
    const string getName() const;
    void setName(const string v);

    // Field : description
    const string getDescription() const;
    void setDescription(const string v);

    // Field : guilds
    class guild& getGuilds(const string v);
    map<string,class guild>& listGuilds();
    void setGuilds(class guild &v);
    void delGuilds(const string v);
    const bool isGuilds(const string v) const;

    void save(class channel &ch);
    void load(class channel &ch);
    void xml(ofstream &f, int l=0, int r=0);
};

// Repository

#define loopCultures(v) loopMap(culture_repo.listCulture(),v,class culture)

class cultureRepository {
    map<string,culture> cultures;
public:
    class culture& getCulture(const string v);
    void setCulture(class culture& v);
    map<string,class culture>& listCulture();
    void delCulture(const string v);
    const bool isCulture(const string v) const;
    multimap<string, sigc::signal<void, class culture& > > relations;
    bool load(class channel &ch);
    void save(class channel &ch);
};

extern cultureRepository culture_repo;

#endif // __CULTURE_H
